import { apiHttp } from '../../apiHttp';
import Api from '../../../api/system/sysUserController.api';
// import { JsonResult, SysUserVO, PageResult ,PasswordDto} from '../../../api/Interface';
 import { JsonResult, SysUserVO, PasswordDto, PageResult, SysUser } from '../../../api/Interface';
import { sysUserSearchDto } from '../systemInterface';
export default {
    // 根据用户Id获取用户信息
    getSysUserById: async (userId: string): Promise<SysUserVO> => {
        const res: JsonResult = await apiHttp(Api.getSysUserById, {userId});
        return res.data;
    },
    //获取用户列表
    sysUserPage: async (listParams: sysUserSearchDto): Promise<PageResult> => { //sysRoleSearchDto
        const res: JsonResult = await apiHttp(Api.sysUserPage, listParams);
        return res.data;
    },
    //根据角色Id获取用户信息
    getByRoleId: async (roleId: string): Promise<SysUser[]> => { //List
        const res: JsonResult = await apiHttp(Api.getByRoleId, {roleId});
        return res.data;
    },
    // 修改用户
    sysUserUpdate: async (roleInfo: SysUserVO): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.sysUserUpdate, roleInfo);
        return res;
    },
    // 根据用户Id删除用户
    sysUserDelete: async (userId: string): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.sysUserDelete, {userId});
        return res;
    },
    // //添加用户
    sysUserInsert: async (userInfo: SysUserVO): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.sysUserInsert, userInfo);
        return res;
    },
    // 用户登录成功回调
    successLoginCallback: async (): Promise<JsonResult> => {
        const res: JsonResult = await apiHttp(Api.successLoginCallback, null);
        return res.data;
    },
    //修改用户密码
    changePwd: async (changePassword: PasswordDto): Promise<JsonResult> => { //roleRecord
        const res: JsonResult = await apiHttp(Api.changePwd, changePassword);
        return res;
    },
};